UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pu3/otJZx1bqnsohcZDU2S1txwKHPAwGE9HamQTQNM0=' 
WHERE 
  key_id = '15999850811165332f7c198fd7b8129c4885e432bbcace38827e04d0c9c091a0' 
  AND (
    token = 'pu3/otJZx1bqnsohcZDU2S1txwKHPAwGE9HamQTQNM0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017