UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0vsLBA0B34uSoMaIPXVlMo6oTUc8ImAKLl3ex2l+uFo=' 
WHERE 
  key_id = '3158d11eaef532dd6a10439a9b83d49983441fd16708c37618614a8a8e6acce4' 
  AND (
    token = '0vsLBA0B34uSoMaIPXVlMo6oTUc8ImAKLl3ex2l+uFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033