UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f4OsbrE74vyfvFjjDPF3yQKg1H634QGeEW8eKanKhZ8=' 
WHERE 
  key_id = '323d680c8d302730a3a791093bc98a369d3725bebda99ff3c62fcd483adc775a' 
  AND (
    token = 'f4OsbrE74vyfvFjjDPF3yQKg1H634QGeEW8eKanKhZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044