UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rHCC6P09gw5rTJBxK8DVvGw7BLdgAQNf8Qy3GMtT2WE=' 
WHERE 
  key_id = '8baa3752061379ce1d927fb506346a93793ae465b5293ade307e373edae10758' 
  AND (
    token = 'rHCC6P09gw5rTJBxK8DVvGw7BLdgAQNf8Qy3GMtT2WE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050