UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YhFkpRcE/nrZxsEAVXon6mgEBPfcWepwEwaPr8k/pQ0=' 
WHERE 
  key_id = '442490e0f126c5110765579dab5ee3cde4ce0e9599b845dd9c2365e37989c246' 
  AND (
    token = 'YhFkpRcE/nrZxsEAVXon6mgEBPfcWepwEwaPr8k/pQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030