UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B71SzdrNZgYGTXCz3EkSM23VFFlob+lsS65cIgF2SHc=' 
WHERE 
  key_id = '89650fa6c6c215966d67885065e68e9617a6da33c9d6df02c5b8b9afac4cc631' 
  AND (
    token = 'B71SzdrNZgYGTXCz3EkSM23VFFlob+lsS65cIgF2SHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028