UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bxbwujOLVONv6xLhZ+b/Lu4dE/BpABdKL39Fgnfj8Ew=' 
WHERE 
  key_id = 'ccfe1aa403282130140f3cbab1ca32072d1e6a65b8f45d5a90fc67e2d65977cd' 
  AND (
    token = 'bxbwujOLVONv6xLhZ+b/Lu4dE/BpABdKL39Fgnfj8Ew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044