UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kDvsv6qMwd6hQOVPydt1XcjssI27YEctMsRDFMp2jnI=' 
WHERE 
  key_id = '2d961d9dd31430b5b67ee2c2b9ea12520a91062b5ba925caab8323e982312384' 
  AND (
    token = 'kDvsv6qMwd6hQOVPydt1XcjssI27YEctMsRDFMp2jnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053