UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mzz6t9/BN8x4Ww3E5x7SB+RnAJ84C7JT5ubvTc3vM9o=' 
WHERE 
  key_id = '7e581dfdfec11b2f571c9df2adaf7d56b4d5b308e788d7e7877927b0b7aa2eac' 
  AND (
    token = 'mzz6t9/BN8x4Ww3E5x7SB+RnAJ84C7JT5ubvTc3vM9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018