UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gYGJyKY6ficqSkyhFh3nbmIKr8WNSA2lfVaUwN4SWMg=' 
WHERE 
  key_id = '7d1c34f3ca25c85a4bb6164074ee17d40e7beb77cfe2a253cb0340c2e5dfa03f' 
  AND (
    token = 'gYGJyKY6ficqSkyhFh3nbmIKr8WNSA2lfVaUwN4SWMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029