UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSNme5OprvMogIbnw60+ZsEr98x+FVsTDcJdZz8NQbo=' 
WHERE 
  key_id = '1e4f4ac82368580f0174bc4746c604fc9888aa7e4eb158eb9e6c9fcdebc9cb42' 
  AND (
    token = 'CSNme5OprvMogIbnw60+ZsEr98x+FVsTDcJdZz8NQbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025