UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y9zPBiTBQpOFGYRGVoB2aFPai9SWYLZWYt2VtGJIgPs=' 
WHERE 
  key_id = '1edc4d1ced5caaa0fdb5e31ddda15e20f80b5744f7816133cd75a8eaeeafbc07' 
  AND (
    token = 'Y9zPBiTBQpOFGYRGVoB2aFPai9SWYLZWYt2VtGJIgPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028