UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WZlZQa+s4JSnXxckGawgLuan/Tupsq/ubHxnGr1dJfA=' 
WHERE 
  key_id = '7e6b0989ad5e010cb097222443c5003aba837e263e914eb47456521e344c85d3' 
  AND (
    token = 'WZlZQa+s4JSnXxckGawgLuan/Tupsq/ubHxnGr1dJfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045