UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FA+WnqMj2SdMFZ1krdSD+3kBscxY/7RuBICIy9MdOsM=' 
WHERE 
  key_id = '1038dba26c79475b1534b0ebfb353720a0adcff1f7481363252963b98c397f7b' 
  AND (
    token = 'FA+WnqMj2SdMFZ1krdSD+3kBscxY/7RuBICIy9MdOsM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038