UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UHJv2gW8Q+qNXOtW2EEU6jh2zbjJmcKYs0p6erZ1o5A=' 
WHERE 
  key_id = '980fe101b4944387640600209104aa8d46d0d5893542edf62847da98186477f9' 
  AND (
    token = 'UHJv2gW8Q+qNXOtW2EEU6jh2zbjJmcKYs0p6erZ1o5A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024