UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G2T6HWelD1eVQXjXNH8nOk+jxplIpFTPaZJZVJyicHA=' 
WHERE 
  key_id = '131038005c94c95acd032023e550b61d3fd02450c65b345e6694c494db791441' 
  AND (
    token = 'G2T6HWelD1eVQXjXNH8nOk+jxplIpFTPaZJZVJyicHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041