UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iJRUod/2LlTvbmN+K9Dv38dulLqf3+rtQXe8I58XN/g=' 
WHERE 
  key_id = 'efb504510d225e68fa58700ccccc0cda1ac384d7508271eed54eb5070d53f057' 
  AND (
    token = 'iJRUod/2LlTvbmN+K9Dv38dulLqf3+rtQXe8I58XN/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051