UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'naDEkjkkERQfziynobq67xjIQdBMfpzVAtt+DgksEcE=' 
WHERE 
  key_id = 'c1c5b73a275d1d2e3bc7f2eda22b9b8a5e74c533a063a3cb2868a44fcb5d20f5' 
  AND (
    token = 'naDEkjkkERQfziynobq67xjIQdBMfpzVAtt+DgksEcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041