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

Query time 0.00048