UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ukXXeOOGhRWxjB7yrJk9VGEPGDLyndPVoDYtBgOQB8k=' 
WHERE 
  key_id = '316da42a90e5dcc1d759390f4b77cac4a31521d7d74908c706c7889e905786bf' 
  AND (
    token = 'ukXXeOOGhRWxjB7yrJk9VGEPGDLyndPVoDYtBgOQB8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031