UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rzac0eLKDwkHXOBcFvQ3AazFNQ6t12/rstCmyNIQyBU=' 
WHERE 
  key_id = '0629f830f9a01d0a56b7c4c0dc05af8332bab1e43a92433c66ce87be805d017b' 
  AND (
    token = 'rzac0eLKDwkHXOBcFvQ3AazFNQ6t12/rstCmyNIQyBU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032