UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BIpqXTzyCp6f35Oe7Oc/RgfbM3c2UzeL2tm481rgkm0=' 
WHERE 
  key_id = 'ea78cda1f6b98844dd6751a441b0fa230903180f568b32dfa912eda432845478' 
  AND (
    token = 'BIpqXTzyCp6f35Oe7Oc/RgfbM3c2UzeL2tm481rgkm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029