UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ggbn/VDhxj008YyIpCxqfvFkBjisRRcGIe6dBvrjSDk=' 
WHERE 
  key_id = '5665bd59a9c5071e8aa69caaffcfd3185c4ffc886b7a63083f89ad1411f538d6' 
  AND (
    token = 'Ggbn/VDhxj008YyIpCxqfvFkBjisRRcGIe6dBvrjSDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028