UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pN02TOdQDkuV/I220N5Xtq8uzdM3K0eBDFGpcf3mQ8Q=' 
WHERE 
  key_id = '8877d94f501c140b96b20d9b3d73eb353ca1174af9f50f572de1cd7e1e1de95d' 
  AND (
    token = 'pN02TOdQDkuV/I220N5Xtq8uzdM3K0eBDFGpcf3mQ8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040