UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'smVS84huoZkZHtj2GFCi/BDBd7ELTvIGOpdKI5goYF8=' 
WHERE 
  key_id = '4980c150252230fce2baf43579035206cf1e003f4314b447034a6c24b37436e5' 
  AND (
    token = 'smVS84huoZkZHtj2GFCi/BDBd7ELTvIGOpdKI5goYF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050