UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N2ZxIwLTWCg/ITzi6tA6sOIsLJMHaaX/03Ril/JtiIk=' 
WHERE 
  key_id = 'e0883312cb45c58d1b55842eee276bbcd45d7033545ccf79849768366bd210e3' 
  AND (
    token = 'N2ZxIwLTWCg/ITzi6tA6sOIsLJMHaaX/03Ril/JtiIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021