UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a//tEtgtmhi7CZ5B6PKRz2ZO3lcNYLONdCFqI45BnA8=' 
WHERE 
  key_id = '131b5d8f69fdfd2cd403cb0c1b696a6ae9b678529f4b61b022b0de77f438165d' 
  AND (
    token = 'a//tEtgtmhi7CZ5B6PKRz2ZO3lcNYLONdCFqI45BnA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042