UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eLp10cD8nTcoDPNczW7UFnbT6RGuXUoewLujVwXMLN8=' 
WHERE 
  key_id = 'b789abb3ab76c42512b3b4da6e71fce194041f16b5f360b4b650370b1835b655' 
  AND (
    token = 'eLp10cD8nTcoDPNczW7UFnbT6RGuXUoewLujVwXMLN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025