UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l2UBXnhod6AMByHLulL9R39Z6KJUXd/SEERAn+Oogoc=' 
WHERE 
  key_id = 'be1a9c51b02003dd0c114d4fd1f0b9653340aca89c653ce46b06a8be2e95e8af' 
  AND (
    token = 'l2UBXnhod6AMByHLulL9R39Z6KJUXd/SEERAn+Oogoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039