UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NA/37d3KAbaTM9fGn8p/+7CWDr6KMGZibxvrWy5nABo=' 
WHERE 
  key_id = 'ca5eb307157aac99a037f32a8af99773da9814cefb800d7dc8bf0583a963f139' 
  AND (
    token = 'NA/37d3KAbaTM9fGn8p/+7CWDr6KMGZibxvrWy5nABo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019