UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W4SP1UrL5vEoDtPY2jLp7TYYMQcQcWpbCjyeqa6yF8c=' 
WHERE 
  key_id = '821e6c8ff6817a3964128ab4d30b1179cbf94895272a5e05df36677f6c58e2ab' 
  AND (
    token = 'W4SP1UrL5vEoDtPY2jLp7TYYMQcQcWpbCjyeqa6yF8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028