UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hQ9VY1bch/R2qOk3yviW8MEIM5T5TXXAfqSAWBpAgpU=' 
WHERE 
  key_id = 'ae1cc53cb121c5eabbe08022cd93689df390f55c69fd0515dc94756346d09d72' 
  AND (
    token = 'hQ9VY1bch/R2qOk3yviW8MEIM5T5TXXAfqSAWBpAgpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032