UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JRZylWpJKPTQMj/62VR8gFdmQj9LJarsxellecc2O1g=' 
WHERE 
  key_id = 'd04dd8b38e8cefc58412a48ccd62d5ca65ef2059b448287bf475289499b5ece5' 
  AND (
    token = 'JRZylWpJKPTQMj/62VR8gFdmQj9LJarsxellecc2O1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023