UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zSSngHonrtytE99obSe8QREsXnc4Xb/edRik/folWJk=' 
WHERE 
  key_id = 'fc4b461c27807ebd49e1ad58f6ad0bacd377f4f9311e6a8091a20e08c22a17c1' 
  AND (
    token = 'zSSngHonrtytE99obSe8QREsXnc4Xb/edRik/folWJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025