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

Query time 0.00034