UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SRgesjl6sJPYuC/QWcJ4XcWyiLoupl+2mMZDfgYh7iE=' 
WHERE 
  key_id = '5c58bdee025396bf3f523a3d6ad0b5f210f8ec1d7b048525ea130fda6bd73319' 
  AND (
    token = 'SRgesjl6sJPYuC/QWcJ4XcWyiLoupl+2mMZDfgYh7iE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034