UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6BarxnGhEqbCpwkiV1uH00l+spbY5Rtoe7NMPzXTX3E=' 
WHERE 
  key_id = '8894a39b15309e56fc26397abfbd1fab89733e2f8feb806c30152a699d5c235f' 
  AND (
    token = '6BarxnGhEqbCpwkiV1uH00l+spbY5Rtoe7NMPzXTX3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041